package com.xjgzinfo.usdp.web.rest;

import com.xjgzinfo.usdp.AvueServer4jApp;
import com.xjgzinfo.usdp.config.TestSecurityConfiguration;
import com.xjgzinfo.usdp.domain.BladeVisual;
import com.xjgzinfo.usdp.repository.BladeVisualRepository;
import com.xjgzinfo.usdp.service.BladeVisualQueryService;
import com.xjgzinfo.usdp.service.BladeVisualService;
import com.xjgzinfo.usdp.service.dto.BladeVisualDTO;
import com.xjgzinfo.usdp.service.mapper.BladeVisualMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

/**
 * Integration tests for the {@link BladeVisualResource} REST controller.
 */
@SpringBootTest(classes = {AvueServer4jApp.class, TestSecurityConfiguration.class})
@AutoConfigureMockMvc
@WithMockUser
public class BladeVisualResourceIT {

    private static final String DEFAULT_BACKGROUND_URL = "AAAAAAAAAA";
    private static final String UPDATED_BACKGROUND_URL = "BBBBBBBBBB";

    private static final Long DEFAULT_CATEGORY = 20L;
    private static final Long UPDATED_CATEGORY = 19L;
    private static final Long SMALLER_CATEGORY = 20L - 1;

    private static final String DEFAULT_TITLE = "AAAAAAAAAA";
    private static final String UPDATED_TITLE = "BBBBBBBBBB";

    private static final Long DEFAULT_UPDATE_USER = 20L;
    private static final Long UPDATED_UPDATE_USER = 19L;
    private static final Long SMALLER_UPDATE_USER = 20L - 1L;

    private static final String DEFAULT_PASSWORD = "AAAAAAAAAA";
    private static final String UPDATED_PASSWORD = "BBBBBBBBBB";

    private static final Long DEFAULT_CREATE_USER = 20L;
    private static final Long UPDATED_CREATE_USER = 19L;
    private static final Long SMALLER_CREATE_USER = 20L - 1L;

    private static final Instant DEFAULT_UPDATE_TIME = Instant.ofEpochMilli(0L);
    private static final Instant UPDATED_UPDATE_TIME = Instant.now().truncatedTo(ChronoUnit.MILLIS);

    private static final Long DEFAULT_CREATE_DEPT = 20L;
    private static final Long UPDATED_CREATE_DEPT = 19L;
    private static final Long SMALLER_CREATE_DEPT = 20L - 1L;

    private static final Instant DEFAULT_CREATE_TIME = Instant.ofEpochMilli(0L);
    private static final Instant UPDATED_CREATE_TIME = Instant.now().truncatedTo(ChronoUnit.MILLIS);

    private static final Integer DEFAULT_STATUS = 10;
    private static final Integer UPDATED_STATUS = 9;
    private static final Integer SMALLER_STATUS = 10 - 1;

    private static final Integer DEFAULT_IS_DELETED = 10;
    private static final Integer UPDATED_IS_DELETED = 9;
    private static final Integer SMALLER_IS_DELETED = 10 - 1;

    @Autowired
    private BladeVisualRepository bladeVisualRepository;

    @Autowired
    private BladeVisualMapper bladeVisualMapper;

    @Autowired
    private BladeVisualService bladeVisualService;

    @Autowired
    private BladeVisualQueryService bladeVisualQueryService;

    @Autowired
    private EntityManager em;

    @Autowired
    private MockMvc restBladeVisualMockMvc;

    private BladeVisual bladeVisual;

    /**
     * Create an entity for this test.
     * <p>
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static BladeVisual createEntity(EntityManager em) {
        BladeVisual bladeVisual = new BladeVisual()
                .backgroundUrl(DEFAULT_BACKGROUND_URL)
                .category(DEFAULT_CATEGORY)
                .title(DEFAULT_TITLE)
                .updateUser(DEFAULT_UPDATE_USER)
                .password(DEFAULT_PASSWORD)
                .createUser(DEFAULT_CREATE_USER)
                .updateTime(DEFAULT_UPDATE_TIME)
                .createDept(DEFAULT_CREATE_DEPT)
                .createTime(DEFAULT_CREATE_TIME)
                .status(DEFAULT_STATUS)
                .isDeleted(DEFAULT_IS_DELETED);
        return bladeVisual;
    }

    /**
     * Create an updated entity for this test.
     * <p>
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static BladeVisual createUpdatedEntity(EntityManager em) {
        BladeVisual bladeVisual = new BladeVisual()
                .backgroundUrl(UPDATED_BACKGROUND_URL)
                .category(UPDATED_CATEGORY)
                .title(UPDATED_TITLE)
                .updateUser(UPDATED_UPDATE_USER)
                .password(UPDATED_PASSWORD)
                .createUser(UPDATED_CREATE_USER)
                .updateTime(UPDATED_UPDATE_TIME)
                .createDept(UPDATED_CREATE_DEPT)
                .createTime(UPDATED_CREATE_TIME)
                .status(UPDATED_STATUS)
                .isDeleted(UPDATED_IS_DELETED);
        return bladeVisual;
    }

    @BeforeEach
    public void initTest() {
        bladeVisual = createEntity(em);
    }

    @Test
    @Transactional
    public void createBladeVisual() throws Exception {
        int databaseSizeBeforeCreate = bladeVisualRepository.findAll().size();
        // Create the BladeVisual
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(bladeVisual);
        restBladeVisualMockMvc.perform(post("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isCreated());

        // Validate the BladeVisual in the database
        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeCreate + 1);
        BladeVisual testBladeVisual = bladeVisualList.get(bladeVisualList.size() - 1);
        assertThat(testBladeVisual.getBackgroundUrl()).isEqualTo(DEFAULT_BACKGROUND_URL);
        assertThat(testBladeVisual.getCategory()).isEqualTo(DEFAULT_CATEGORY);
        assertThat(testBladeVisual.getTitle()).isEqualTo(DEFAULT_TITLE);
        assertThat(testBladeVisual.getUpdateUser()).isEqualTo(DEFAULT_UPDATE_USER);
        assertThat(testBladeVisual.getPassword()).isEqualTo(DEFAULT_PASSWORD);
        assertThat(testBladeVisual.getCreateUser()).isEqualTo(DEFAULT_CREATE_USER);
        assertThat(testBladeVisual.getUpdateTime()).isEqualTo(DEFAULT_UPDATE_TIME);
        assertThat(testBladeVisual.getCreateDept()).isEqualTo(DEFAULT_CREATE_DEPT);
        assertThat(testBladeVisual.getCreateTime()).isEqualTo(DEFAULT_CREATE_TIME);
        assertThat(testBladeVisual.getStatus()).isEqualTo(DEFAULT_STATUS);
        assertThat(testBladeVisual.getIsDeleted()).isEqualTo(DEFAULT_IS_DELETED);
    }

    @Test
    @Transactional
    public void createBladeVisualWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = bladeVisualRepository.findAll().size();

        // Create the BladeVisual with an existing ID
        bladeVisual.setId(1L);
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(bladeVisual);

        // An entity with an existing ID cannot be created, so this API call must fail
        restBladeVisualMockMvc.perform(post("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isBadRequest());

        // Validate the BladeVisual in the database
        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeCreate);
    }


    @Test
    @Transactional
    public void checkStatusIsRequired() throws Exception {
        int databaseSizeBeforeTest = bladeVisualRepository.findAll().size();
        // set the field null
        bladeVisual.setStatus(null);

        // Create the BladeVisual, which fails.
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(bladeVisual);


        restBladeVisualMockMvc.perform(post("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isBadRequest());

        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void checkIsDeletedIsRequired() throws Exception {
        int databaseSizeBeforeTest = bladeVisualRepository.findAll().size();
        // set the field null
        bladeVisual.setIsDeleted(null);

        // Create the BladeVisual, which fails.
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(bladeVisual);


        restBladeVisualMockMvc.perform(post("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isBadRequest());

        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeTest);
    }

    @Test
    @Transactional
    public void getAllBladeVisuals() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList
        restBladeVisualMockMvc.perform(get("/api/blade-visuals?sort=id,desc"))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(jsonPath("$.[*].id").value(hasItem(bladeVisual.getId().intValue())))
                .andExpect(jsonPath("$.[*].backgroundUrl").value(hasItem(DEFAULT_BACKGROUND_URL.toString())))
                .andExpect(jsonPath("$.[*].category").value(hasItem(DEFAULT_CATEGORY)))
                .andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE)))
                .andExpect(jsonPath("$.[*].updateUser").value(hasItem(DEFAULT_UPDATE_USER.intValue())))
                .andExpect(jsonPath("$.[*].password").value(hasItem(DEFAULT_PASSWORD)))
                .andExpect(jsonPath("$.[*].createUser").value(hasItem(DEFAULT_CREATE_USER.intValue())))
                .andExpect(jsonPath("$.[*].updateTime").value(hasItem(DEFAULT_UPDATE_TIME.toString())))
                .andExpect(jsonPath("$.[*].createDept").value(hasItem(DEFAULT_CREATE_DEPT.intValue())))
                .andExpect(jsonPath("$.[*].createTime").value(hasItem(DEFAULT_CREATE_TIME.toString())))
                .andExpect(jsonPath("$.[*].status").value(hasItem(DEFAULT_STATUS)))
                .andExpect(jsonPath("$.[*].isDeleted").value(hasItem(DEFAULT_IS_DELETED)));
    }

    @Test
    @Transactional
    public void getBladeVisual() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get the bladeVisual
        restBladeVisualMockMvc.perform(get("/api/blade-visuals/{id}", bladeVisual.getId()))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(jsonPath("$.id").value(bladeVisual.getId().intValue()))
                .andExpect(jsonPath("$.backgroundUrl").value(DEFAULT_BACKGROUND_URL.toString()))
                .andExpect(jsonPath("$.category").value(DEFAULT_CATEGORY))
                .andExpect(jsonPath("$.title").value(DEFAULT_TITLE))
                .andExpect(jsonPath("$.updateUser").value(DEFAULT_UPDATE_USER.intValue()))
                .andExpect(jsonPath("$.password").value(DEFAULT_PASSWORD))
                .andExpect(jsonPath("$.createUser").value(DEFAULT_CREATE_USER.intValue()))
                .andExpect(jsonPath("$.updateTime").value(DEFAULT_UPDATE_TIME.toString()))
                .andExpect(jsonPath("$.createDept").value(DEFAULT_CREATE_DEPT.intValue()))
                .andExpect(jsonPath("$.createTime").value(DEFAULT_CREATE_TIME.toString()))
                .andExpect(jsonPath("$.status").value(DEFAULT_STATUS))
                .andExpect(jsonPath("$.isDeleted").value(DEFAULT_IS_DELETED));
    }


    @Test
    @Transactional
    public void getBladeVisualsByIdFiltering() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        Long id = bladeVisual.getId();

        defaultBladeVisualShouldBeFound("id.equals=" + id);
        defaultBladeVisualShouldNotBeFound("id.notEquals=" + id);

        defaultBladeVisualShouldBeFound("id.greaterThanOrEqual=" + id);
        defaultBladeVisualShouldNotBeFound("id.greaterThan=" + id);

        defaultBladeVisualShouldBeFound("id.lessThanOrEqual=" + id);
        defaultBladeVisualShouldNotBeFound("id.lessThan=" + id);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category equals to DEFAULT_CATEGORY
        defaultBladeVisualShouldBeFound("category.equals=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category equals to UPDATED_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.equals=" + UPDATED_CATEGORY);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category not equals to DEFAULT_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.notEquals=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category not equals to UPDATED_CATEGORY
        defaultBladeVisualShouldBeFound("category.notEquals=" + UPDATED_CATEGORY);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category in DEFAULT_CATEGORY or UPDATED_CATEGORY
        defaultBladeVisualShouldBeFound("category.in=" + DEFAULT_CATEGORY + "," + UPDATED_CATEGORY);

        // Get all the bladeVisualList where category equals to UPDATED_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.in=" + UPDATED_CATEGORY);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category is not null
        defaultBladeVisualShouldBeFound("category.specified=true");

        // Get all the bladeVisualList where category is null
        defaultBladeVisualShouldNotBeFound("category.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category is greater than or equal to DEFAULT_CATEGORY
        defaultBladeVisualShouldBeFound("category.greaterThanOrEqual=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category is greater than or equal to (DEFAULT_CATEGORY + 1)
        defaultBladeVisualShouldNotBeFound("category.greaterThanOrEqual=" + (DEFAULT_CATEGORY + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category is less than or equal to DEFAULT_CATEGORY
        defaultBladeVisualShouldBeFound("category.lessThanOrEqual=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category is less than or equal to SMALLER_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.lessThanOrEqual=" + SMALLER_CATEGORY);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category is less than DEFAULT_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.lessThan=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category is less than (DEFAULT_CATEGORY + 1)
        defaultBladeVisualShouldBeFound("category.lessThan=" + (DEFAULT_CATEGORY + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCategoryIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where category is greater than DEFAULT_CATEGORY
        defaultBladeVisualShouldNotBeFound("category.greaterThan=" + DEFAULT_CATEGORY);

        // Get all the bladeVisualList where category is greater than SMALLER_CATEGORY
        defaultBladeVisualShouldBeFound("category.greaterThan=" + SMALLER_CATEGORY);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByTitleIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title equals to DEFAULT_TITLE
        defaultBladeVisualShouldBeFound("title.equals=" + DEFAULT_TITLE);

        // Get all the bladeVisualList where title equals to UPDATED_TITLE
        defaultBladeVisualShouldNotBeFound("title.equals=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByTitleIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title not equals to DEFAULT_TITLE
        defaultBladeVisualShouldNotBeFound("title.notEquals=" + DEFAULT_TITLE);

        // Get all the bladeVisualList where title not equals to UPDATED_TITLE
        defaultBladeVisualShouldBeFound("title.notEquals=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByTitleIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title in DEFAULT_TITLE or UPDATED_TITLE
        defaultBladeVisualShouldBeFound("title.in=" + DEFAULT_TITLE + "," + UPDATED_TITLE);

        // Get all the bladeVisualList where title equals to UPDATED_TITLE
        defaultBladeVisualShouldNotBeFound("title.in=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByTitleIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title is not null
        defaultBladeVisualShouldBeFound("title.specified=true");

        // Get all the bladeVisualList where title is null
        defaultBladeVisualShouldNotBeFound("title.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByTitleContainsSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title contains DEFAULT_TITLE
        defaultBladeVisualShouldBeFound("title.contains=" + DEFAULT_TITLE);

        // Get all the bladeVisualList where title contains UPDATED_TITLE
        defaultBladeVisualShouldNotBeFound("title.contains=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByTitleNotContainsSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where title does not contain DEFAULT_TITLE
        defaultBladeVisualShouldNotBeFound("title.doesNotContain=" + DEFAULT_TITLE);

        // Get all the bladeVisualList where title does not contain UPDATED_TITLE
        defaultBladeVisualShouldBeFound("title.doesNotContain=" + UPDATED_TITLE);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser equals to DEFAULT_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.equals=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser equals to UPDATED_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.equals=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser not equals to DEFAULT_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.notEquals=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser not equals to UPDATED_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.notEquals=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser in DEFAULT_UPDATE_USER or UPDATED_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.in=" + DEFAULT_UPDATE_USER + "," + UPDATED_UPDATE_USER);

        // Get all the bladeVisualList where updateUser equals to UPDATED_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.in=" + UPDATED_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser is not null
        defaultBladeVisualShouldBeFound("updateUser.specified=true");

        // Get all the bladeVisualList where updateUser is null
        defaultBladeVisualShouldNotBeFound("updateUser.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser is greater than or equal to DEFAULT_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.greaterThanOrEqual=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser is greater than or equal to (DEFAULT_UPDATE_USER + 1)
        defaultBladeVisualShouldNotBeFound("updateUser.greaterThanOrEqual=" + (DEFAULT_UPDATE_USER + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser is less than or equal to DEFAULT_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.lessThanOrEqual=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser is less than or equal to SMALLER_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.lessThanOrEqual=" + SMALLER_UPDATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser is less than DEFAULT_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.lessThan=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser is less than (DEFAULT_UPDATE_USER + 1)
        defaultBladeVisualShouldBeFound("updateUser.lessThan=" + (DEFAULT_UPDATE_USER + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateUserIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateUser is greater than DEFAULT_UPDATE_USER
        defaultBladeVisualShouldNotBeFound("updateUser.greaterThan=" + DEFAULT_UPDATE_USER);

        // Get all the bladeVisualList where updateUser is greater than SMALLER_UPDATE_USER
        defaultBladeVisualShouldBeFound("updateUser.greaterThan=" + SMALLER_UPDATE_USER);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password equals to DEFAULT_PASSWORD
        defaultBladeVisualShouldBeFound("password.equals=" + DEFAULT_PASSWORD);

        // Get all the bladeVisualList where password equals to UPDATED_PASSWORD
        defaultBladeVisualShouldNotBeFound("password.equals=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password not equals to DEFAULT_PASSWORD
        defaultBladeVisualShouldNotBeFound("password.notEquals=" + DEFAULT_PASSWORD);

        // Get all the bladeVisualList where password not equals to UPDATED_PASSWORD
        defaultBladeVisualShouldBeFound("password.notEquals=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password in DEFAULT_PASSWORD or UPDATED_PASSWORD
        defaultBladeVisualShouldBeFound("password.in=" + DEFAULT_PASSWORD + "," + UPDATED_PASSWORD);

        // Get all the bladeVisualList where password equals to UPDATED_PASSWORD
        defaultBladeVisualShouldNotBeFound("password.in=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password is not null
        defaultBladeVisualShouldBeFound("password.specified=true");

        // Get all the bladeVisualList where password is null
        defaultBladeVisualShouldNotBeFound("password.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordContainsSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password contains DEFAULT_PASSWORD
        defaultBladeVisualShouldBeFound("password.contains=" + DEFAULT_PASSWORD);

        // Get all the bladeVisualList where password contains UPDATED_PASSWORD
        defaultBladeVisualShouldNotBeFound("password.contains=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByPasswordNotContainsSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where password does not contain DEFAULT_PASSWORD
        defaultBladeVisualShouldNotBeFound("password.doesNotContain=" + DEFAULT_PASSWORD);

        // Get all the bladeVisualList where password does not contain UPDATED_PASSWORD
        defaultBladeVisualShouldBeFound("password.doesNotContain=" + UPDATED_PASSWORD);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser equals to DEFAULT_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.equals=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser equals to UPDATED_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.equals=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser not equals to DEFAULT_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.notEquals=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser not equals to UPDATED_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.notEquals=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser in DEFAULT_CREATE_USER or UPDATED_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.in=" + DEFAULT_CREATE_USER + "," + UPDATED_CREATE_USER);

        // Get all the bladeVisualList where createUser equals to UPDATED_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.in=" + UPDATED_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser is not null
        defaultBladeVisualShouldBeFound("createUser.specified=true");

        // Get all the bladeVisualList where createUser is null
        defaultBladeVisualShouldNotBeFound("createUser.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser is greater than or equal to DEFAULT_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.greaterThanOrEqual=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser is greater than or equal to (DEFAULT_CREATE_USER + 1)
        defaultBladeVisualShouldNotBeFound("createUser.greaterThanOrEqual=" + (DEFAULT_CREATE_USER + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser is less than or equal to DEFAULT_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.lessThanOrEqual=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser is less than or equal to SMALLER_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.lessThanOrEqual=" + SMALLER_CREATE_USER);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser is less than DEFAULT_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.lessThan=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser is less than (DEFAULT_CREATE_USER + 1)
        defaultBladeVisualShouldBeFound("createUser.lessThan=" + (DEFAULT_CREATE_USER + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateUserIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createUser is greater than DEFAULT_CREATE_USER
        defaultBladeVisualShouldNotBeFound("createUser.greaterThan=" + DEFAULT_CREATE_USER);

        // Get all the bladeVisualList where createUser is greater than SMALLER_CREATE_USER
        defaultBladeVisualShouldBeFound("createUser.greaterThan=" + SMALLER_CREATE_USER);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateTime equals to DEFAULT_UPDATE_TIME
        defaultBladeVisualShouldBeFound("updateTime.equals=" + DEFAULT_UPDATE_TIME);

        // Get all the bladeVisualList where updateTime equals to UPDATED_UPDATE_TIME
        defaultBladeVisualShouldNotBeFound("updateTime.equals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateTime not equals to DEFAULT_UPDATE_TIME
        defaultBladeVisualShouldNotBeFound("updateTime.notEquals=" + DEFAULT_UPDATE_TIME);

        // Get all the bladeVisualList where updateTime not equals to UPDATED_UPDATE_TIME
        defaultBladeVisualShouldBeFound("updateTime.notEquals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateTime in DEFAULT_UPDATE_TIME or UPDATED_UPDATE_TIME
        defaultBladeVisualShouldBeFound("updateTime.in=" + DEFAULT_UPDATE_TIME + "," + UPDATED_UPDATE_TIME);

        // Get all the bladeVisualList where updateTime equals to UPDATED_UPDATE_TIME
        defaultBladeVisualShouldNotBeFound("updateTime.in=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByUpdateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where updateTime is not null
        defaultBladeVisualShouldBeFound("updateTime.specified=true");

        // Get all the bladeVisualList where updateTime is null
        defaultBladeVisualShouldNotBeFound("updateTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept equals to DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.equals=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept equals to UPDATED_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.equals=" + UPDATED_CREATE_DEPT);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept not equals to DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.notEquals=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept not equals to UPDATED_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.notEquals=" + UPDATED_CREATE_DEPT);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept in DEFAULT_CREATE_DEPT or UPDATED_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.in=" + DEFAULT_CREATE_DEPT + "," + UPDATED_CREATE_DEPT);

        // Get all the bladeVisualList where createDept equals to UPDATED_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.in=" + UPDATED_CREATE_DEPT);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept is not null
        defaultBladeVisualShouldBeFound("createDept.specified=true");

        // Get all the bladeVisualList where createDept is null
        defaultBladeVisualShouldNotBeFound("createDept.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept is greater than or equal to DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.greaterThanOrEqual=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept is greater than or equal to (DEFAULT_CREATE_DEPT + 1)
        defaultBladeVisualShouldNotBeFound("createDept.greaterThanOrEqual=" + (DEFAULT_CREATE_DEPT + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept is less than or equal to DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.lessThanOrEqual=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept is less than or equal to SMALLER_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.lessThanOrEqual=" + SMALLER_CREATE_DEPT);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept is less than DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.lessThan=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept is less than (DEFAULT_CREATE_DEPT + 1)
        defaultBladeVisualShouldBeFound("createDept.lessThan=" + (DEFAULT_CREATE_DEPT + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateDeptIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createDept is greater than DEFAULT_CREATE_DEPT
        defaultBladeVisualShouldNotBeFound("createDept.greaterThan=" + DEFAULT_CREATE_DEPT);

        // Get all the bladeVisualList where createDept is greater than SMALLER_CREATE_DEPT
        defaultBladeVisualShouldBeFound("createDept.greaterThan=" + SMALLER_CREATE_DEPT);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByCreateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createTime equals to DEFAULT_CREATE_TIME
        defaultBladeVisualShouldBeFound("createTime.equals=" + DEFAULT_CREATE_TIME);

        // Get all the bladeVisualList where createTime equals to UPDATED_CREATE_TIME
        defaultBladeVisualShouldNotBeFound("createTime.equals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createTime not equals to DEFAULT_CREATE_TIME
        defaultBladeVisualShouldNotBeFound("createTime.notEquals=" + DEFAULT_CREATE_TIME);

        // Get all the bladeVisualList where createTime not equals to UPDATED_CREATE_TIME
        defaultBladeVisualShouldBeFound("createTime.notEquals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createTime in DEFAULT_CREATE_TIME or UPDATED_CREATE_TIME
        defaultBladeVisualShouldBeFound("createTime.in=" + DEFAULT_CREATE_TIME + "," + UPDATED_CREATE_TIME);

        // Get all the bladeVisualList where createTime equals to UPDATED_CREATE_TIME
        defaultBladeVisualShouldNotBeFound("createTime.in=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByCreateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where createTime is not null
        defaultBladeVisualShouldBeFound("createTime.specified=true");

        // Get all the bladeVisualList where createTime is null
        defaultBladeVisualShouldNotBeFound("createTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status equals to DEFAULT_STATUS
        defaultBladeVisualShouldBeFound("status.equals=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status equals to UPDATED_STATUS
        defaultBladeVisualShouldNotBeFound("status.equals=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status not equals to DEFAULT_STATUS
        defaultBladeVisualShouldNotBeFound("status.notEquals=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status not equals to UPDATED_STATUS
        defaultBladeVisualShouldBeFound("status.notEquals=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status in DEFAULT_STATUS or UPDATED_STATUS
        defaultBladeVisualShouldBeFound("status.in=" + DEFAULT_STATUS + "," + UPDATED_STATUS);

        // Get all the bladeVisualList where status equals to UPDATED_STATUS
        defaultBladeVisualShouldNotBeFound("status.in=" + UPDATED_STATUS);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status is not null
        defaultBladeVisualShouldBeFound("status.specified=true");

        // Get all the bladeVisualList where status is null
        defaultBladeVisualShouldNotBeFound("status.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status is greater than or equal to DEFAULT_STATUS
        defaultBladeVisualShouldBeFound("status.greaterThanOrEqual=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status is greater than or equal to (DEFAULT_STATUS + 1)
        defaultBladeVisualShouldNotBeFound("status.greaterThanOrEqual=" + (DEFAULT_STATUS + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status is less than or equal to DEFAULT_STATUS
        defaultBladeVisualShouldBeFound("status.lessThanOrEqual=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status is less than or equal to SMALLER_STATUS
        defaultBladeVisualShouldNotBeFound("status.lessThanOrEqual=" + SMALLER_STATUS);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status is less than DEFAULT_STATUS
        defaultBladeVisualShouldNotBeFound("status.lessThan=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status is less than (DEFAULT_STATUS + 1)
        defaultBladeVisualShouldBeFound("status.lessThan=" + (DEFAULT_STATUS + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByStatusIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where status is greater than DEFAULT_STATUS
        defaultBladeVisualShouldNotBeFound("status.greaterThan=" + DEFAULT_STATUS);

        // Get all the bladeVisualList where status is greater than SMALLER_STATUS
        defaultBladeVisualShouldBeFound("status.greaterThan=" + SMALLER_STATUS);
    }


    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted equals to DEFAULT_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.equals=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted equals to UPDATED_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.equals=" + UPDATED_IS_DELETED);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted not equals to DEFAULT_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.notEquals=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted not equals to UPDATED_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.notEquals=" + UPDATED_IS_DELETED);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsInShouldWork() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted in DEFAULT_IS_DELETED or UPDATED_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.in=" + DEFAULT_IS_DELETED + "," + UPDATED_IS_DELETED);

        // Get all the bladeVisualList where isDeleted equals to UPDATED_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.in=" + UPDATED_IS_DELETED);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsNullOrNotNull() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted is not null
        defaultBladeVisualShouldBeFound("isDeleted.specified=true");

        // Get all the bladeVisualList where isDeleted is null
        defaultBladeVisualShouldNotBeFound("isDeleted.specified=false");
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted is greater than or equal to DEFAULT_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.greaterThanOrEqual=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted is greater than or equal to (DEFAULT_IS_DELETED + 1)
        defaultBladeVisualShouldNotBeFound("isDeleted.greaterThanOrEqual=" + (DEFAULT_IS_DELETED + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted is less than or equal to DEFAULT_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.lessThanOrEqual=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted is less than or equal to SMALLER_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.lessThanOrEqual=" + SMALLER_IS_DELETED);
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsLessThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted is less than DEFAULT_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.lessThan=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted is less than (DEFAULT_IS_DELETED + 1)
        defaultBladeVisualShouldBeFound("isDeleted.lessThan=" + (DEFAULT_IS_DELETED + 1));
    }

    @Test
    @Transactional
    public void getAllBladeVisualsByIsDeletedIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        // Get all the bladeVisualList where isDeleted is greater than DEFAULT_IS_DELETED
        defaultBladeVisualShouldNotBeFound("isDeleted.greaterThan=" + DEFAULT_IS_DELETED);

        // Get all the bladeVisualList where isDeleted is greater than SMALLER_IS_DELETED
        defaultBladeVisualShouldBeFound("isDeleted.greaterThan=" + SMALLER_IS_DELETED);
    }

    /**
     * Executes the search, and checks that the default entity is returned.
     */
    private void defaultBladeVisualShouldBeFound(String filter) throws Exception {
        restBladeVisualMockMvc.perform(get("/api/blade-visuals?sort=id,desc&" + filter))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(jsonPath("$.[*].id").value(hasItem(bladeVisual.getId().intValue())))
                .andExpect(jsonPath("$.[*].backgroundUrl").value(hasItem(DEFAULT_BACKGROUND_URL.toString())))
                .andExpect(jsonPath("$.[*].category").value(hasItem(DEFAULT_CATEGORY)))
                .andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE)))
                .andExpect(jsonPath("$.[*].updateUser").value(hasItem(DEFAULT_UPDATE_USER.intValue())))
                .andExpect(jsonPath("$.[*].password").value(hasItem(DEFAULT_PASSWORD)))
                .andExpect(jsonPath("$.[*].createUser").value(hasItem(DEFAULT_CREATE_USER.intValue())))
                .andExpect(jsonPath("$.[*].updateTime").value(hasItem(DEFAULT_UPDATE_TIME.toString())))
                .andExpect(jsonPath("$.[*].createDept").value(hasItem(DEFAULT_CREATE_DEPT.intValue())))
                .andExpect(jsonPath("$.[*].createTime").value(hasItem(DEFAULT_CREATE_TIME.toString())))
                .andExpect(jsonPath("$.[*].status").value(hasItem(DEFAULT_STATUS)))
                .andExpect(jsonPath("$.[*].isDeleted").value(hasItem(DEFAULT_IS_DELETED)));

        // Check, that the count call also returns 1
        restBladeVisualMockMvc.perform(get("/api/blade-visuals/count?sort=id,desc&" + filter))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(content().string("1"));
    }

    /**
     * Executes the search, and checks that the default entity is not returned.
     */
    private void defaultBladeVisualShouldNotBeFound(String filter) throws Exception {
        restBladeVisualMockMvc.perform(get("/api/blade-visuals?sort=id,desc&" + filter))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(jsonPath("$").isArray())
                .andExpect(jsonPath("$").isEmpty());

        // Check, that the count call also returns 0
        restBladeVisualMockMvc.perform(get("/api/blade-visuals/count?sort=id,desc&" + filter))
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
                .andExpect(content().string("0"));
    }

    @Test
    @Transactional
    public void getNonExistingBladeVisual() throws Exception {
        // Get the bladeVisual
        restBladeVisualMockMvc.perform(get("/api/blade-visuals/{id}", Long.MAX_VALUE))
                .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateBladeVisual() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        int databaseSizeBeforeUpdate = bladeVisualRepository.findAll().size();

        // Update the bladeVisual
        BladeVisual updatedBladeVisual = bladeVisualRepository.findById(bladeVisual.getId()).get();
        // Disconnect from session so that the updates on updatedBladeVisual are not directly saved in db
        em.detach(updatedBladeVisual);
        updatedBladeVisual
                .backgroundUrl(UPDATED_BACKGROUND_URL)
                .category(UPDATED_CATEGORY)
                .title(UPDATED_TITLE)
                .updateUser(UPDATED_UPDATE_USER)
                .password(UPDATED_PASSWORD)
                .createUser(UPDATED_CREATE_USER)
                .updateTime(UPDATED_UPDATE_TIME)
                .createDept(UPDATED_CREATE_DEPT)
                .createTime(UPDATED_CREATE_TIME)
                .status(UPDATED_STATUS)
                .isDeleted(UPDATED_IS_DELETED);
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(updatedBladeVisual);

        restBladeVisualMockMvc.perform(put("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isOk());

        // Validate the BladeVisual in the database
        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeUpdate);
        BladeVisual testBladeVisual = bladeVisualList.get(bladeVisualList.size() - 1);
        assertThat(testBladeVisual.getBackgroundUrl()).isEqualTo(UPDATED_BACKGROUND_URL);
        assertThat(testBladeVisual.getCategory()).isEqualTo(UPDATED_CATEGORY);
        assertThat(testBladeVisual.getTitle()).isEqualTo(UPDATED_TITLE);
        assertThat(testBladeVisual.getUpdateUser()).isEqualTo(UPDATED_UPDATE_USER);
        assertThat(testBladeVisual.getPassword()).isEqualTo(UPDATED_PASSWORD);
        assertThat(testBladeVisual.getCreateUser()).isEqualTo(UPDATED_CREATE_USER);
        assertThat(testBladeVisual.getUpdateTime()).isEqualTo(UPDATED_UPDATE_TIME);
        assertThat(testBladeVisual.getCreateDept()).isEqualTo(UPDATED_CREATE_DEPT);
        assertThat(testBladeVisual.getCreateTime()).isEqualTo(UPDATED_CREATE_TIME);
        assertThat(testBladeVisual.getStatus()).isEqualTo(UPDATED_STATUS);
        assertThat(testBladeVisual.getIsDeleted()).isEqualTo(UPDATED_IS_DELETED);
    }

    @Test
    @Transactional
    public void updateNonExistingBladeVisual() throws Exception {
        int databaseSizeBeforeUpdate = bladeVisualRepository.findAll().size();

        // Create the BladeVisual
        BladeVisualDTO bladeVisualDTO = bladeVisualMapper.toDto(bladeVisual);

        // If the entity doesn't have an ID, it will throw BadRequestAlertException
        restBladeVisualMockMvc.perform(put("/api/blade-visuals").with(csrf())
                .contentType(MediaType.APPLICATION_JSON)
                .content(TestUtil.convertObjectToJsonBytes(bladeVisualDTO)))
                .andExpect(status().isBadRequest());

        // Validate the BladeVisual in the database
        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeUpdate);
    }

    @Test
    @Transactional
    public void deleteBladeVisual() throws Exception {
        // Initialize the database
        bladeVisualRepository.saveAndFlush(bladeVisual);

        int databaseSizeBeforeDelete = bladeVisualRepository.findAll().size();

        // Delete the bladeVisual
        restBladeVisualMockMvc.perform(delete("/api/blade-visuals/{id}", bladeVisual.getId()).with(csrf())
                .accept(MediaType.APPLICATION_JSON))
                .andExpect(status().isNoContent());

        // Validate the database contains one less item
        List<BladeVisual> bladeVisualList = bladeVisualRepository.findAll();
        assertThat(bladeVisualList).hasSize(databaseSizeBeforeDelete - 1);
    }
}
